<template>
    <div>
      <el-input :modelValue="userName" @update:modelValue="handleInput"></el-input>
      <button @click="handleSubmit">测试提交</button>
    </div>
</template>

<script setup>
import { ref,defineProps,defineEmits } from "vue";
const props=defineProps({
    modelValue:{
        type:String
    }
})
const emit=defineEmits(['handleInput','handleSubmit'])
let userName=ref(props.modelValue)
const handleInput=(val)=>{
console.log(val);
userName.value=val
emit("update:modelValue",userName)
}
const handleSubmit=()=>{
   emit("handleSubmit",userName)
}
</script>

<style lang="scss" scoped>

</style>